<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui">
<h:head>
	<title>角色游戏服设置</title>
	<link href="../../css/component.css" rel="stylesheet" type="text/css" />
</h:head>

<ui:param name="bean" value="#{roleServManager}" />

<h:body>
	<h:form id="ulist">
		<p:messages id="messages" showDetail="true" autoUpdate="true" />
		<p:panel id="panel2" header="角色游戏服设置"	style="text-align:center; margin:2%;">
			<h:panelGrid id="registerPanel" columns="2" cellpadding="2"	style="margin: 0 auto;">
				<p:outputLabel value="当前角色" style="text-align:right" />
				<p:selectOneMenu value="#{bean.roleId}" label="当前角色">
					<f:selectItem itemLabel="选择角色" itemValue="0" />
					<f:selectItems value="#{bean.roleMap.entrySet()}" var="entry"	itemLabel="#{entry.value.name}" itemValue="#{entry.key}" />
					 <p:ajax event="change" listener="#{bean.change()}" update=":ulist"/>
				</p:selectOneMenu>
			</h:panelGrid>
			<p:panelGrid id="panel3" style="margin: 0 auto;">
				<p:row>
					<p:column width="40%" style="text-align:center;vertical-align:top">
						<p:outputLabel value="可选游戏服列表" style="text-align:left;vertical-align:top"/>
						<p:dataTable id="dlist1" var="serv" value="#{bean.leftList}"  resizableColumns="true" paginator="true" rows="12" width="40%">
							<p:column headerText="选择" style="text-align:center" width="12%">
								<h:selectBooleanCheckbox value="#{bean.selected[serv.id]}" />
							</p:column>
							<p:column headerText="游戏服标识" style="text-align:center" width="15%">
								<h:outputText value="#{serv.id}"   styleClass="text-align:center" />
							</p:column>
							<p:column headerText="游戏服名称" style="text-align:center" width="30%">
								<h:outputText value="#{serv.name}" styleClass="text-align:center" />
							</p:column>								
						</p:dataTable>
					</p:column>
					<p:column width="20%" style="text-align:center;vertical-align:top">
						<p:commandButton action="#{bean.select()}"  value="选择"		update=":ulist" ajax="true"/>
						<p:commandButton action="#{bean.unSelect()}" value="取消"		update=":ulist" ajax="true"/>
					</p:column>
					<p:column width="40%" style="text-align:center;vertical-align:top">
						<p:outputLabel value="已选游戏服列表" style="text-align:left;vertical-align:top"/>
						<p:dataTable id="dlist2" var="serv" value="#{bean.rightList}" resizableColumns="true" paginator="true" rows="12" width="40%">
							<p:column headerText="选择" style="text-align:center" width="12%">
								<h:selectBooleanCheckbox value="#{bean.unselected[serv.id]}" />
							</p:column>
							<p:column headerText="游戏服标识" style="text-align:center"  width="15%">
								<h:outputText value="#{serv.id}"   styleClass="text-align:center" />
							</p:column>
							<p:column headerText="游戏服名称" style="text-align:center"  width="30%">
								<h:outputText value="#{serv.name}" styleClass="text-align:center" />
							</p:column>	
						</p:dataTable>
					</p:column>
				</p:row>
			</p:panelGrid>
			<p:commandButton action="#{bean.save()}" value="保存" update=":ulist" 	ajax="true" />
		</p:panel>
	</h:form>
</h:body>
</html>